import { ElMessageBox } from "element-plus";
import type { VNode, RendererNode, RendererElement } from "vue";

export default function useConfig(text: string | VNode<RendererNode, RendererElement, { [key: string]: any; }> | (() => VNode) | undefined) {
  // 返回ElMessageBox.confirm的Promise结果
  return ElMessageBox.confirm(text, "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      // 如果用户点击了确认按钮
      return true;
    })
    .catch(() => {
      // 如果用户点击了取消按钮或者关闭了对话框
      return false;
    });
}
